[rc2] Fix temporal table versioning when removing default constraints from columns#36667
[rc2] Fix temporal table versioning when removing default constraints from columns#36667AndriySvyryd merged 8 commits intorelease/10.0from
Conversation
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs
Outdated
Show resolved
Hide resolved
AndriySvyryd
left a comment
There was a problem hiding this comment.
@copilot Rewrite the PR summary using this template:
Fixes #{number}
**Description**
{Issue description}
**Customer impact**
{How does the reported issue affects customer's app? Are there workarounds?}
**How found**
{Was it customer reported or found during verification? How many customers are affected?}
**Regression**
{Is it a regression from a released version? Which one?}
**Testing**
{How the changes were tested}
**Risk**
{Low/Medium/High, argument why}
|
@copilot Continue |
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
... Here's the PR summary rewritten using the template: Fixes #35631 Description Customer impact How found Regression Testing Risk
Completed the requested tasks:
The fix modifies |
Modified AlterColumnOperation handling to detect when default values are being removed and disable versioning in that case. Updated test to remove default value in target model and adjusted expected SQL output. Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Added tests for adding default constraints and changing default constraint values on temporal table columns to provide comprehensive coverage of default constraint handling scenarios. Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.TemporalTables.cs
Show resolved
Hide resolved
…alueSql test Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs
Outdated
Show resolved
Hide resolved
…r.cs Co-authored-by: Shay Rojansky <roji@roji.org>
Fixes #35631
Description
When using SQL Server temporal tables, removing a DEFAULT constraint failed as this requires versioning to be temporarily disabled.
Customer impact
Customers would get an exception when applying a migration that removes a DEFAULT constraint. Workarounds include avoiding removing DEFAULT constraints and disabling versioning manually.
How found
Customer reported on EF9.
Regression
Yes, from EF8.
Testing
Added test Temporal_table_with_default_constraint_can_alter_column that verifies temporal tables with DEFAULT constraints can have their columns altered successfully. Also added tests for other facets including
HasDefaultValueSql.Risk
Low. The change only affects migrations on temporal tables.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.